package com.nervenets.general.entity;

import com.nervenets.general.utils.JodaUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class WsMessage implements Serializable {
    @ApiModelProperty(value = "时间")
    @Builder.Default
    private long time = JodaUtils.getTimestamp();
    @ApiModelProperty(value = "指令")
    private String action;
    @ApiModelProperty(value = "标题")
    private String title;
    @ApiModelProperty(value = "消息")
    private String message;
    @ApiModelProperty(value = "传输数据")
    private String data;

    public WsMessage(String action) {
        this.action = action;
    }

    public WsMessage(String action, String data) {
        this.action = action;
        this.data = data;
    }

    public WsMessage(String action, String message, String data) {
        this.action = action;
        this.message = message;
        this.data = data;
    }

    public WsMessage(String action, String title, String message, String data) {
        this.action = action;
        this.title = title;
        this.message = message;
        this.data = data;
    }
}
